package com.iwhalecloud.bss.kite.cucc.listener.attr;

import com.iwhalecloud.bss.kite.cucc.listener.handler.CuccPriceFactorHandler;
import com.iwhalecloud.bss.kite.event.attr.UpdateAttrValueEvent;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @Description 属性值更新监听器
 * @Author deng.gang
 * @Date 2021/11/13 3:49 下午
 */
@Component
public class CuccUpdateAttrValueEventListener {

    @Autowired
    private CuccPriceFactorHandler cuccPriceFactorHandler;

    @EventListener
    @Order(11)
    @Async
    public void refreshStandardPrice(UpdateAttrValueEvent event) {
        KiteAttr kiteAttr = event.getKiteAttr();
        KiteInst kiteInst = event.getInst();
        AttrData attrData = event.getAttrData();
        cuccPriceFactorHandler.refreshStandardPrice(kiteAttr, kiteInst, attrData);
    }
}
